package qldc.pm.tiensu.model;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.BaseModel;
import com.liferay.portal.model.impl.BaseModelImpl;

import qldc.pm.tiensu.service.ClpSerializer;
import qldc.pm.tiensu.service.KetQuaTrichLucLocalServiceUtil;

import java.io.Serializable;

import java.lang.reflect.Method;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;


public class KetQuaTrichLucClp extends BaseModelImpl<KetQuaTrichLuc>
    implements KetQuaTrichLuc {
    private long _ketQuaTrichLucId;
    private long _yeuCauTrichLucId;
    private String _maKetQuaTrichLuc;
    private String _kinhGui;
    private String _tinhTrangAnTich;
    private String _thongTinAnTich;
    private String _toiDanh;
    private String _hinhPhatChinh;
    private String _hinhPhatBoSung;
    private String _trinhTrangThiHanhAn;
    private String _nguoiTraCuuHoSo;
    private Date _ngayTraCuu;
    private int _ketQua;
    private BaseModel<?> _ketQuaTrichLucRemoteModel;

    public KetQuaTrichLucClp() {
    }

    @Override
    public Class<?> getModelClass() {
        return KetQuaTrichLuc.class;
    }

    @Override
    public String getModelClassName() {
        return KetQuaTrichLuc.class.getName();
    }

    @Override
    public long getPrimaryKey() {
        return _ketQuaTrichLucId;
    }

    @Override
    public void setPrimaryKey(long primaryKey) {
        setKetQuaTrichLucId(primaryKey);
    }

    @Override
    public Serializable getPrimaryKeyObj() {
        return _ketQuaTrichLucId;
    }

    @Override
    public void setPrimaryKeyObj(Serializable primaryKeyObj) {
        setPrimaryKey(((Long) primaryKeyObj).longValue());
    }

    @Override
    public Map<String, Object> getModelAttributes() {
        Map<String, Object> attributes = new HashMap<String, Object>();

        attributes.put("ketQuaTrichLucId", getKetQuaTrichLucId());
        attributes.put("yeuCauTrichLucId", getYeuCauTrichLucId());
        attributes.put("maKetQuaTrichLuc", getMaKetQuaTrichLuc());
        attributes.put("kinhGui", getKinhGui());
        attributes.put("tinhTrangAnTich", getTinhTrangAnTich());
        attributes.put("thongTinAnTich", getThongTinAnTich());
        attributes.put("toiDanh", getToiDanh());
        attributes.put("hinhPhatChinh", getHinhPhatChinh());
        attributes.put("hinhPhatBoSung", getHinhPhatBoSung());
        attributes.put("trinhTrangThiHanhAn", getTrinhTrangThiHanhAn());
        attributes.put("nguoiTraCuuHoSo", getNguoiTraCuuHoSo());
        attributes.put("ngayTraCuu", getNgayTraCuu());
        attributes.put("ketQua", getKetQua());

        return attributes;
    }

    @Override
    public void setModelAttributes(Map<String, Object> attributes) {
        Long ketQuaTrichLucId = (Long) attributes.get("ketQuaTrichLucId");

        if (ketQuaTrichLucId != null) {
            setKetQuaTrichLucId(ketQuaTrichLucId);
        }

        Long yeuCauTrichLucId = (Long) attributes.get("yeuCauTrichLucId");

        if (yeuCauTrichLucId != null) {
            setYeuCauTrichLucId(yeuCauTrichLucId);
        }

        String maKetQuaTrichLuc = (String) attributes.get("maKetQuaTrichLuc");

        if (maKetQuaTrichLuc != null) {
            setMaKetQuaTrichLuc(maKetQuaTrichLuc);
        }

        String kinhGui = (String) attributes.get("kinhGui");

        if (kinhGui != null) {
            setKinhGui(kinhGui);
        }

        String tinhTrangAnTich = (String) attributes.get("tinhTrangAnTich");

        if (tinhTrangAnTich != null) {
            setTinhTrangAnTich(tinhTrangAnTich);
        }

        String thongTinAnTich = (String) attributes.get("thongTinAnTich");

        if (thongTinAnTich != null) {
            setThongTinAnTich(thongTinAnTich);
        }

        String toiDanh = (String) attributes.get("toiDanh");

        if (toiDanh != null) {
            setToiDanh(toiDanh);
        }

        String hinhPhatChinh = (String) attributes.get("hinhPhatChinh");

        if (hinhPhatChinh != null) {
            setHinhPhatChinh(hinhPhatChinh);
        }

        String hinhPhatBoSung = (String) attributes.get("hinhPhatBoSung");

        if (hinhPhatBoSung != null) {
            setHinhPhatBoSung(hinhPhatBoSung);
        }

        String trinhTrangThiHanhAn = (String) attributes.get(
                "trinhTrangThiHanhAn");

        if (trinhTrangThiHanhAn != null) {
            setTrinhTrangThiHanhAn(trinhTrangThiHanhAn);
        }

        String nguoiTraCuuHoSo = (String) attributes.get("nguoiTraCuuHoSo");

        if (nguoiTraCuuHoSo != null) {
            setNguoiTraCuuHoSo(nguoiTraCuuHoSo);
        }

        Date ngayTraCuu = (Date) attributes.get("ngayTraCuu");

        if (ngayTraCuu != null) {
            setNgayTraCuu(ngayTraCuu);
        }

        Integer ketQua = (Integer) attributes.get("ketQua");

        if (ketQua != null) {
            setKetQua(ketQua);
        }
    }

    @Override
    public long getKetQuaTrichLucId() {
        return _ketQuaTrichLucId;
    }

    @Override
    public void setKetQuaTrichLucId(long ketQuaTrichLucId) {
        _ketQuaTrichLucId = ketQuaTrichLucId;

        if (_ketQuaTrichLucRemoteModel != null) {
            try {
                Class<?> clazz = _ketQuaTrichLucRemoteModel.getClass();

                Method method = clazz.getMethod("setKetQuaTrichLucId",
                        long.class);

                method.invoke(_ketQuaTrichLucRemoteModel, ketQuaTrichLucId);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public long getYeuCauTrichLucId() {
        return _yeuCauTrichLucId;
    }

    @Override
    public void setYeuCauTrichLucId(long yeuCauTrichLucId) {
        _yeuCauTrichLucId = yeuCauTrichLucId;

        if (_ketQuaTrichLucRemoteModel != null) {
            try {
                Class<?> clazz = _ketQuaTrichLucRemoteModel.getClass();

                Method method = clazz.getMethod("setYeuCauTrichLucId",
                        long.class);

                method.invoke(_ketQuaTrichLucRemoteModel, yeuCauTrichLucId);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public String getMaKetQuaTrichLuc() {
        return _maKetQuaTrichLuc;
    }

    @Override
    public void setMaKetQuaTrichLuc(String maKetQuaTrichLuc) {
        _maKetQuaTrichLuc = maKetQuaTrichLuc;

        if (_ketQuaTrichLucRemoteModel != null) {
            try {
                Class<?> clazz = _ketQuaTrichLucRemoteModel.getClass();

                Method method = clazz.getMethod("setMaKetQuaTrichLuc",
                        String.class);

                method.invoke(_ketQuaTrichLucRemoteModel, maKetQuaTrichLuc);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public String getKinhGui() {
        return _kinhGui;
    }

    @Override
    public void setKinhGui(String kinhGui) {
        _kinhGui = kinhGui;

        if (_ketQuaTrichLucRemoteModel != null) {
            try {
                Class<?> clazz = _ketQuaTrichLucRemoteModel.getClass();

                Method method = clazz.getMethod("setKinhGui", String.class);

                method.invoke(_ketQuaTrichLucRemoteModel, kinhGui);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public String getTinhTrangAnTich() {
        return _tinhTrangAnTich;
    }

    @Override
    public void setTinhTrangAnTich(String tinhTrangAnTich) {
        _tinhTrangAnTich = tinhTrangAnTich;

        if (_ketQuaTrichLucRemoteModel != null) {
            try {
                Class<?> clazz = _ketQuaTrichLucRemoteModel.getClass();

                Method method = clazz.getMethod("setTinhTrangAnTich",
                        String.class);

                method.invoke(_ketQuaTrichLucRemoteModel, tinhTrangAnTich);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public String getThongTinAnTich() {
        return _thongTinAnTich;
    }

    @Override
    public void setThongTinAnTich(String thongTinAnTich) {
        _thongTinAnTich = thongTinAnTich;

        if (_ketQuaTrichLucRemoteModel != null) {
            try {
                Class<?> clazz = _ketQuaTrichLucRemoteModel.getClass();

                Method method = clazz.getMethod("setThongTinAnTich",
                        String.class);

                method.invoke(_ketQuaTrichLucRemoteModel, thongTinAnTich);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public String getToiDanh() {
        return _toiDanh;
    }

    @Override
    public void setToiDanh(String toiDanh) {
        _toiDanh = toiDanh;

        if (_ketQuaTrichLucRemoteModel != null) {
            try {
                Class<?> clazz = _ketQuaTrichLucRemoteModel.getClass();

                Method method = clazz.getMethod("setToiDanh", String.class);

                method.invoke(_ketQuaTrichLucRemoteModel, toiDanh);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public String getHinhPhatChinh() {
        return _hinhPhatChinh;
    }

    @Override
    public void setHinhPhatChinh(String hinhPhatChinh) {
        _hinhPhatChinh = hinhPhatChinh;

        if (_ketQuaTrichLucRemoteModel != null) {
            try {
                Class<?> clazz = _ketQuaTrichLucRemoteModel.getClass();

                Method method = clazz.getMethod("setHinhPhatChinh", String.class);

                method.invoke(_ketQuaTrichLucRemoteModel, hinhPhatChinh);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public String getHinhPhatBoSung() {
        return _hinhPhatBoSung;
    }

    @Override
    public void setHinhPhatBoSung(String hinhPhatBoSung) {
        _hinhPhatBoSung = hinhPhatBoSung;

        if (_ketQuaTrichLucRemoteModel != null) {
            try {
                Class<?> clazz = _ketQuaTrichLucRemoteModel.getClass();

                Method method = clazz.getMethod("setHinhPhatBoSung",
                        String.class);

                method.invoke(_ketQuaTrichLucRemoteModel, hinhPhatBoSung);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public String getTrinhTrangThiHanhAn() {
        return _trinhTrangThiHanhAn;
    }

    @Override
    public void setTrinhTrangThiHanhAn(String trinhTrangThiHanhAn) {
        _trinhTrangThiHanhAn = trinhTrangThiHanhAn;

        if (_ketQuaTrichLucRemoteModel != null) {
            try {
                Class<?> clazz = _ketQuaTrichLucRemoteModel.getClass();

                Method method = clazz.getMethod("setTrinhTrangThiHanhAn",
                        String.class);

                method.invoke(_ketQuaTrichLucRemoteModel, trinhTrangThiHanhAn);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public String getNguoiTraCuuHoSo() {
        return _nguoiTraCuuHoSo;
    }

    @Override
    public void setNguoiTraCuuHoSo(String nguoiTraCuuHoSo) {
        _nguoiTraCuuHoSo = nguoiTraCuuHoSo;

        if (_ketQuaTrichLucRemoteModel != null) {
            try {
                Class<?> clazz = _ketQuaTrichLucRemoteModel.getClass();

                Method method = clazz.getMethod("setNguoiTraCuuHoSo",
                        String.class);

                method.invoke(_ketQuaTrichLucRemoteModel, nguoiTraCuuHoSo);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public Date getNgayTraCuu() {
        return _ngayTraCuu;
    }

    @Override
    public void setNgayTraCuu(Date ngayTraCuu) {
        _ngayTraCuu = ngayTraCuu;

        if (_ketQuaTrichLucRemoteModel != null) {
            try {
                Class<?> clazz = _ketQuaTrichLucRemoteModel.getClass();

                Method method = clazz.getMethod("setNgayTraCuu", Date.class);

                method.invoke(_ketQuaTrichLucRemoteModel, ngayTraCuu);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public int getKetQua() {
        return _ketQua;
    }

    @Override
    public void setKetQua(int ketQua) {
        _ketQua = ketQua;

        if (_ketQuaTrichLucRemoteModel != null) {
            try {
                Class<?> clazz = _ketQuaTrichLucRemoteModel.getClass();

                Method method = clazz.getMethod("setKetQua", int.class);

                method.invoke(_ketQuaTrichLucRemoteModel, ketQua);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    public BaseModel<?> getKetQuaTrichLucRemoteModel() {
        return _ketQuaTrichLucRemoteModel;
    }

    public void setKetQuaTrichLucRemoteModel(
        BaseModel<?> ketQuaTrichLucRemoteModel) {
        _ketQuaTrichLucRemoteModel = ketQuaTrichLucRemoteModel;
    }

    public Object invokeOnRemoteModel(String methodName,
        Class<?>[] parameterTypes, Object[] parameterValues)
        throws Exception {
        Object[] remoteParameterValues = new Object[parameterValues.length];

        for (int i = 0; i < parameterValues.length; i++) {
            if (parameterValues[i] != null) {
                remoteParameterValues[i] = ClpSerializer.translateInput(parameterValues[i]);
            }
        }

        Class<?> remoteModelClass = _ketQuaTrichLucRemoteModel.getClass();

        ClassLoader remoteModelClassLoader = remoteModelClass.getClassLoader();

        Class<?>[] remoteParameterTypes = new Class[parameterTypes.length];

        for (int i = 0; i < parameterTypes.length; i++) {
            if (parameterTypes[i].isPrimitive()) {
                remoteParameterTypes[i] = parameterTypes[i];
            } else {
                String parameterTypeName = parameterTypes[i].getName();

                remoteParameterTypes[i] = remoteModelClassLoader.loadClass(parameterTypeName);
            }
        }

        Method method = remoteModelClass.getMethod(methodName,
                remoteParameterTypes);

        Object returnValue = method.invoke(_ketQuaTrichLucRemoteModel,
                remoteParameterValues);

        if (returnValue != null) {
            returnValue = ClpSerializer.translateOutput(returnValue);
        }

        return returnValue;
    }

    @Override
    public void persist() throws SystemException {
        if (this.isNew()) {
            KetQuaTrichLucLocalServiceUtil.addKetQuaTrichLuc(this);
        } else {
            KetQuaTrichLucLocalServiceUtil.updateKetQuaTrichLuc(this);
        }
    }

    @Override
    public KetQuaTrichLuc toEscapedModel() {
        return (KetQuaTrichLuc) ProxyUtil.newProxyInstance(KetQuaTrichLuc.class.getClassLoader(),
            new Class[] { KetQuaTrichLuc.class },
            new AutoEscapeBeanHandler(this));
    }

    @Override
    public Object clone() {
        KetQuaTrichLucClp clone = new KetQuaTrichLucClp();

        clone.setKetQuaTrichLucId(getKetQuaTrichLucId());
        clone.setYeuCauTrichLucId(getYeuCauTrichLucId());
        clone.setMaKetQuaTrichLuc(getMaKetQuaTrichLuc());
        clone.setKinhGui(getKinhGui());
        clone.setTinhTrangAnTich(getTinhTrangAnTich());
        clone.setThongTinAnTich(getThongTinAnTich());
        clone.setToiDanh(getToiDanh());
        clone.setHinhPhatChinh(getHinhPhatChinh());
        clone.setHinhPhatBoSung(getHinhPhatBoSung());
        clone.setTrinhTrangThiHanhAn(getTrinhTrangThiHanhAn());
        clone.setNguoiTraCuuHoSo(getNguoiTraCuuHoSo());
        clone.setNgayTraCuu(getNgayTraCuu());
        clone.setKetQua(getKetQua());

        return clone;
    }

    @Override
    public int compareTo(KetQuaTrichLuc ketQuaTrichLuc) {
        int value = 0;

        if (getKetQuaTrichLucId() < ketQuaTrichLuc.getKetQuaTrichLucId()) {
            value = -1;
        } else if (getKetQuaTrichLucId() > ketQuaTrichLuc.getKetQuaTrichLucId()) {
            value = 1;
        } else {
            value = 0;
        }

        value = value * -1;

        if (value != 0) {
            return value;
        }

        return 0;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }

        if (!(obj instanceof KetQuaTrichLucClp)) {
            return false;
        }

        KetQuaTrichLucClp ketQuaTrichLuc = (KetQuaTrichLucClp) obj;

        long primaryKey = ketQuaTrichLuc.getPrimaryKey();

        if (getPrimaryKey() == primaryKey) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public int hashCode() {
        return (int) getPrimaryKey();
    }

    @Override
    public String toString() {
        StringBundler sb = new StringBundler(27);

        sb.append("{ketQuaTrichLucId=");
        sb.append(getKetQuaTrichLucId());
        sb.append(", yeuCauTrichLucId=");
        sb.append(getYeuCauTrichLucId());
        sb.append(", maKetQuaTrichLuc=");
        sb.append(getMaKetQuaTrichLuc());
        sb.append(", kinhGui=");
        sb.append(getKinhGui());
        sb.append(", tinhTrangAnTich=");
        sb.append(getTinhTrangAnTich());
        sb.append(", thongTinAnTich=");
        sb.append(getThongTinAnTich());
        sb.append(", toiDanh=");
        sb.append(getToiDanh());
        sb.append(", hinhPhatChinh=");
        sb.append(getHinhPhatChinh());
        sb.append(", hinhPhatBoSung=");
        sb.append(getHinhPhatBoSung());
        sb.append(", trinhTrangThiHanhAn=");
        sb.append(getTrinhTrangThiHanhAn());
        sb.append(", nguoiTraCuuHoSo=");
        sb.append(getNguoiTraCuuHoSo());
        sb.append(", ngayTraCuu=");
        sb.append(getNgayTraCuu());
        sb.append(", ketQua=");
        sb.append(getKetQua());
        sb.append("}");

        return sb.toString();
    }

    @Override
    public String toXmlString() {
        StringBundler sb = new StringBundler(43);

        sb.append("<model><model-name>");
        sb.append("qldc.pm.tiensu.model.KetQuaTrichLuc");
        sb.append("</model-name>");

        sb.append(
            "<column><column-name>ketQuaTrichLucId</column-name><column-value><![CDATA[");
        sb.append(getKetQuaTrichLucId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>yeuCauTrichLucId</column-name><column-value><![CDATA[");
        sb.append(getYeuCauTrichLucId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>maKetQuaTrichLuc</column-name><column-value><![CDATA[");
        sb.append(getMaKetQuaTrichLuc());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>kinhGui</column-name><column-value><![CDATA[");
        sb.append(getKinhGui());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>tinhTrangAnTich</column-name><column-value><![CDATA[");
        sb.append(getTinhTrangAnTich());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>thongTinAnTich</column-name><column-value><![CDATA[");
        sb.append(getThongTinAnTich());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>toiDanh</column-name><column-value><![CDATA[");
        sb.append(getToiDanh());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>hinhPhatChinh</column-name><column-value><![CDATA[");
        sb.append(getHinhPhatChinh());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>hinhPhatBoSung</column-name><column-value><![CDATA[");
        sb.append(getHinhPhatBoSung());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>trinhTrangThiHanhAn</column-name><column-value><![CDATA[");
        sb.append(getTrinhTrangThiHanhAn());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>nguoiTraCuuHoSo</column-name><column-value><![CDATA[");
        sb.append(getNguoiTraCuuHoSo());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>ngayTraCuu</column-name><column-value><![CDATA[");
        sb.append(getNgayTraCuu());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>ketQua</column-name><column-value><![CDATA[");
        sb.append(getKetQua());
        sb.append("]]></column-value></column>");

        sb.append("</model>");

        return sb.toString();
    }
}
